import { ApiProperty } from '@nestjs/swagger';
import { IsOptional, IsNumber } from 'class-validator';
import { ClassAttribute } from '../../entities/dbField';
import { CreateCourseDto } from './create-course.dto';

// 用户模糊搜索
export class GetCourseDto {
  @ApiProperty({ example: '1', description: '页码' })
  @IsOptional()
  page: number;

  @ApiProperty({ example: '10', description: '页数' })
  @IsOptional()
  limit?: number;

  @ApiProperty({ example: '', description: '课程名' })
  @IsOptional()
  name?: string;

  @ApiProperty({
    example: '公共课,专业课',
    description: '课程属性',
    required: false,
  })
  @IsOptional()
  attribute?: ClassAttribute;

  @ApiProperty({ example: '', description: '教师id' })
  @IsOptional()
  teacher_id?: string;

  @ApiProperty({ example: '', description: '专业id' })
  @IsOptional()
  major_id?: string;
}

// swagger 返回dto
export class ReturnCourseDtoList {
  @ApiProperty({ type: [CreateCourseDto], description: '列表内容' })
  content: CreateCourseDto[];
  @ApiProperty({ description: '页码' })
  totalElements: number;
  @ApiProperty({ description: '页数' })
  totalPages?: number;
}
